package com.campus.activity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.campus.activity.entity.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 学生Mapper接口
 * 
 * @author System
 * @since 2024
 */
@Mapper
public interface StudentMapper extends BaseMapper<Student> {

    /**
     * 根据学号查询学生
     * 
     * @param studentNumber 学号
     * @return 学生信息
     */
    @Select("SELECT * FROM student WHERE student_number = #{studentNumber} AND deleted = 0")
    List<Student> selectByStudentNumber(@Param("studentNumber") String studentNumber);

    /**
     * 根据姓名模糊查询学生
     * 
     * @param studentName 学生姓名
     * @return 学生信息
     */
    @Select("SELECT * FROM student WHERE student_name LIKE CONCAT('%', #{studentName}, '%') AND deleted = 0")
    List<Student> selectByStudentName(@Param("studentName") String studentName);
}